#include <stdio.h>
#include <string.h>
#define maxn 1010

int isTerminated(char*guess,int n);

int main(int argc, char const *argv[])
{
	int number,ans[maxn],guess[maxn],counter=0;
	int A=0,B=0;
	while(scanf("%d",&number)==1&number)
	{
		memset(ans,'/0',sizeof(ans));
		memset(guess,'/0',sizeof(guess));

		A=B=0;
		counter+=1;
		for (int i = 0; i < number; ++i)
		{
			scanf("%d",&ans[i]);
		}

		for (int i = 0; i < number; ++i)
		{
			scanf("%d",&guess[i]);
		}

		if(isTerminated(guess,number))
		{
			continue;
		}
		else
		{
			//do calculation
			printf("Game %d:\n", counter);
			for (int i = 0; i < number; ++i)
			{
				if(ans[i]==guess[i])
				{
					A++;
				}

				if(strchr(ans,guess[i]))
				{
					B++;
				}
			}
			printf("(%d,%d)\n",A,B );
		}
	}


	return 0;
}

int isTerminated(char*guess,int n)
{
	for (int i = 0; i < n; ++i)
	{
		if(guess[i]!=0)
			return 0;
	}
	return 1;
}